import request from '@/utils/request'

// 保存任务[创建,修改]
export function saveByPublicer(data) {
  return request({
    url: '/api/v1/task/saveByPublicer',
    method: 'post',
    data
  })
}

export function saveByReceiver(data) {
  return request({
    url: '/api/v1/task/saveByReceiver',
    method: 'post',
    data
  })
}

export function receiveTaskById(data) {
  return request({
    url: '/api/v1/task/receiveTaskById',
    method: 'post',
    data
  })
}

//
export function getListByPublicerDDId({ id: id, page: page, limit: limit }) {
  return request({
    url: '/api/v1/task/getListByPublicerDDId/' + id,
    method: 'get',
    params: { page: page, limit: limit }
  })
}

// 获取已经接受的列表
export function getAcceptedListForReceivers({ publicer_dd_id: publicer_dd_id, receiver_dd_id: receiver_dd_id, status: status, start_time: start_time, end_time: end_time, page: page, limit: limit }) {
  return request({
    url: '/api/v1/task/getAcceptedListForReceivers?page=' + page + '&limit=' + limit,
    method: 'post',
    params: { publicer_dd_id: publicer_dd_id, receiver_dd_id: receiver_dd_id, status: status, start_time: start_time, end_time: end_time }
  })
}

// 获取未处理的
export function getUnacceptedListForReceivers({ id: id, page: page, limit: limit }) {
  return request({
    url: '/api/v1/task/getUnacceptedListForReceivers/' + id,
    method: 'get',
    params: { page: page, limit: limit }
  })
}

// 获取任务详情通过任务ID
export function getDetailById(id) {
  return request({
    url: '/api/v1/task/getDetailById/' + id,
    method: 'get'
  })
}

